
declare var window: Window & { hljs: any }

// 初始化语法高亮
export function initHighlighting() {
  const hljs = window.hljs
  if (hljs && hljs.initHighlighting) {
    hljs.initHighlighting.called = false
    hljs.initHighlighting()
  } else {
    console.warn("初始化语法高亮失败")
  }
}

export function stripHTML(html: string) {
  const reTag = /<(?:.|\s)*?>/g;
  return html.replace(reTag, "");
}